#include "OpenGLSupport.h"

#include "OpenGLCamera.h"
#include "../Camera.h"
#include "../../Math/Constants.h"


namespace helix
{

	OpenGLCamera::OpenGLCamera()
	{
			for(int i=0;i<3;i++)
			{
				position[i]=0;
				angles[i]=0;
			}
	}

	OpenGLCamera::~OpenGLCamera()
	{
		Log().Println("OpenGL Camera Deleted.");
	}

	void OpenGLCamera::display()
	{
		glTranslatef(-position[0],-position[1],-position[2]);
		glRotatef(angles[1]*RADTODEG,0.0,1.0,0.0);
		glRotatef(angles[0]*RADTODEG,1.0,0.0,0.0);
		glRotatef(angles[2]*RADTODEG,0.0,0.0,1.0);
	}

	void OpenGLCamera::display(Camera *cam)
	{
		glRotatef(cam->xRot()*RADTODEG,1.0f,0.0f,0.0f);
		glRotatef(cam->yRot()*RADTODEG,0.0f,1.0f,0.0f);
		glRotatef(cam->zRot()*RADTODEG,0.0f,0.0f,1.0f);
		glTranslatef(-cam->x(),-cam->x(),-cam->x());
		
	}

}